home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
xreversi
/
xreversi.txt
< prev
Wrap
Text File
|
1995-12-10
|
7KB
|
162 lines
I decided to donate my "Extended Reversi" program to the public domain.
This program supports 8x8, 10x10, 16x16, and 20x20 board sizes.
The larger board sizes introduce an entire mid-game concept.
The Visual Basic verson 3.0 source code is included within SOURCE.ZIP.
To run the executable, you will need a copy of VBRUN300.DLL on your
system.
The author can be reached by electronic mail at:
rrutt@delphi.com
-- Rick
10-Dec-1995
The game of Reversi
From "The Board Game Book", by R.C. Bell,
(c) 1979 by Marshall Cavendish Limited
ISBN 0 89535 007 6
Library of Congress Catalog Card Number 79-84789
The Knapp Press, publishers, Los Angeles
distributed by The Viking Press, New York
"Reversi was invented [in England] by Mr. Waterman in 1888 and
published by Messrs. Jacques and Son. There were sixty-four
pieces, blue on one side and yellow on the other, colours
contrasting well with the standard nineteenth century black and
white Draughts/Checkers boards. Reversi has recently enjoyed
renewed popularity under the name Othello."
[And due to being delivered with Microsoft Windows V3.0 ...]
XReversi, by Rick Rutt, extends the game to allow larger boards
(by using the computer to provide accuracy and convenience for
large reversals).
The original game had a special opening protocol:
The board starts EMPTY.
A playing piece is tossed (like a coin toss).
The winner of the toss elects to go 1st or 2nd.
The 1st player places a piece (their color up) on ANY of the
four central squares.
The 2nd player places another piece (their color up) on any of
the 3 remaining central squares.
The 1st player places another piece (their color up) on either of
the 2 remaining central squares.
The 2nd player places another piece (their color up) on the
last central square.
The XReversi program simulates this with a random outcome of
the entire protocol.
The "modern" opening, taken from Gabriel's Othello (tm), starts
with diagonally opposed player pieces on the four central squares.
Play then continues: the 1st player places a piece (their color up)
on any empty square adjacent to an opponent's piece, and flanked
in an unbroken line (of opponent pieces) by one of the player's
own pieces, either in a straight line or diagonally. All such
flanked pieces are reversed (including any in other directions
that are also flanked).
Play alternates.
If a player does not have a legal move, they must forfeit the turn.
If both players must forfeit successively, the game is over.
Otherwise, the game ends when the board is full.
The player with the most pieces of their own color showing wins.
(New player "handicapping"): The weaker player wins a tie,
or the stronger player must win by a predetermined number of pieces.
(Above rules were adapted from R.C. Bell's book.)
This version of the game has its own history:
In about 1983, Guy Rind (of ADP Network Services) located a Dartmouth
Basic program that played Othello -- the computer simply went for the
most pieces reversed each turn.
Guy added escape sequences so the program (when running on a
DECsystem-10) updated the X's and O's in-place on a VT-100 using
double-high/wide characters. User input was still <row><col><return>
in response to a text prompt, such as "B5".
I had been playing the board game version of Othello ((tm) of Gabriel)
with my brother, and had a personal tactical approach that did not
require "look ahead". (I like the "visual gestalt" approach.)
I then added the position rating arrays to the program to emulate my
personal game style.
In about 1984, I left ADP, so I retyped the game into a Texas
Instruments 99/4A home computer, using Extended Basic.
In 1985, I modified the program to use the TI's "mosaic graphics"
features, and to use a joystick to point to the desired move square.
TI Basic was interpreted, and the interpreter used interpreted
pseudo-instructions in turn, so it was slow. To provide distraction
while the computer "thought", the display highlighted each square as the
computer evaluated it. After 1 or 2 MINUTES, it made a move.
(To reward the patient player, all moves were recorded in an array, and
the end of the game was followed by an "instant replay" of the whole
game. This ran quickly, since no "thought" was needed.)
In 1986 I bought a dual-floppy MS-DOS portable and a copy of Turbo
Pascal v3.0 -- I retyped the game in yet again, converting to Pascal
syntax. Graphics were used, but no pointer. Input was two successive
digit keys for the row and col (no <return> needed).
Play was fast, so I made another version with a 10x10 board.
This adds a new "mid game" tactical stage to the game.
(These versions are still useful on HP 95LX, 100LX and 200LX
MS-DOS palmtop computers, and can be obtained by anonymous FTP
from eddie.mit.edu in the directory /pub/hp95lx/NEW as a uuencoded
copy of a .ZIP file called hprvrsi.uue (as of 10-Dec-1995).)
Later, I got Turbo Pascal for Windows. (At that time I had a 16 mHz
386sx clone and MS-Windows 3.0) I adapted the Pascal program to work
with the ObjectWindows framework. This version does not properly set
check marks or greyed-out choices in menus; it does not have "buttons"
-- instead you click with different mouse buttons to get different
actions. (I had not learned all the Windows resources yet.)
This version also added double size boards (16x16 and 20x20). The
mid-game becomes a major part of the game with these.
In the summer of 1991, I bought Visual Basic -- because a magazine
reviewer claimed it was as significant as Turbo Pascal v3.0 had been
in 1984. He was right.
I visually drew my game form, and added chuncks of action code.
Then I imported pieces of Pascal, and manually adapted syntax
(while hiding indoors, with lots of Labatts, from the heat wave).
A few END IF bracketing errors caused some bugs, but not many. The
incremental compiler feature IS BEAUTIFUL in finding and fixing these
in the middle of a game.
Visual Basic made adding the buttons, check marks, and grey-outs easy.
Enjoy the game,
-- Rick